//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package 力扣.题库.未分类.demo20AND40;

import java.util.ArrayList;
import java.util.List;

public class demo22 {
    List<String> res = new ArrayList();

    public demo22() {
    }

    public List<String> generateParenthesis(int n) {
        if (n <= 0) {
            return null;
        } else {
            this.def("", 0, 0, n);
            return this.res;
        }
    }

    public void def(String paths, int left, int right, int n) {
        if (left <= n && right <= left) {
            if (paths.length() == n * 2) {
                this.res.add(paths);
            } else {
                this.def(paths + "(", left + 1, right, n);
                this.def(paths + ")", left, right + 1, n);
            }
        }
    }
}
